import 'package:flutter/material.dart';

class Test1 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    bool _switchSelected = true; //维护单选开关状态

    TextEditingController _unameController = new TextEditingController(); //获取.编辑文字内容
    return Material(
      child: Padding(
        padding: EdgeInsets.only(top: 40),
        child: Column(
          children: <Widget>[
            Text.rich(TextSpan(children: [
              TextSpan(text: "Home: "),
              TextSpan(
                text: "https://flutterchina.club",
                style: TextStyle(color: Colors.blue),
              ),
            ])),
            Switch(value: _switchSelected, onChanged: (value) {}),
            TextField(
              autofocus: true,
              controller: _unameController,
              onChanged: (v) {
                //文字改变监听
                print("onChanged$v");
              },
            ),
            Expanded(
              child: ListView.builder(
                  itemCount: 150,
                  shrinkWrap: true,
                  itemExtent: 50,
                  itemBuilder: (BuildContext context, int index) {
                    return ListTile(title: Text("$index"));
                  }),
            )
          ],
        ),
      ),
    );
  }
}
